package com.zuoyy.common.validate;

import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class ValidationResult implements Serializable {

    private boolean isPass;
    private List<String> errorMessage = new ArrayList();

    public ValidationResult() {
    }

    public ValidationResult(boolean ispass, List<String> errorMessage) {
        this.isPass = ispass;
        if (errorMessage != null) {
            this.errorMessage = errorMessage;
        }

    }

    public void AddErrorMessage(String msg) {
        if (!StringUtils.isEmpty(msg)) {
            this.errorMessage.add(msg);
        }

    }

    public void AddErrorMessage(List<String> msgs) {
        if (this.errorMessage != null) {
            this.errorMessage.addAll(msgs);
        }

    }

    public boolean isPass() {
        return this.isPass;
    }

    public void setPass(boolean pass) {
        this.isPass = pass;
    }

    public List<String> getErrorMessage() {
        return this.errorMessage;
    }

    public void setErrorMessage(List<String> errorMessage) {
        this.errorMessage = errorMessage;
    }

}
